(bug 15739) Add $wgArticlePathForCurid to make links with only curid=# as the query...
authorMatt Johnston <mattj@users.mediawiki.org>
Sat, 27 Sep 2008 09:49:23 +0000 (09:49 +0000)
committerMatt Johnston <mattj@users.mediawiki.org>
Sat, 27 Sep 2008 09:49:23 +0000 (09:49 +0000)
RELEASE-NOTES
includes/DefaultSettings.php
includes/Title.php

index 828dc5b..30609b3 100644 (file)
@@ -140,6 +140,8 @@ The following extensions are migrated into MediaWiki 1.14:
   restriction types on the protection form.
 * (bug 8440) Allow preventing blocked users from editing their talk pages
 * Improved upload file type detection for OpenDocument formats
+* (bug 15739) Add $wgArticlePathForCurid to make links with only curid=# as the
+  query string use the article path, rather than the script path
 
 
 === Bug fixes in 1.14 ===
index c1582bd..b54d3b9 100644 (file)
@@ -3434,3 +3434,10 @@ $wgUseAutomaticEditSummaries = true;
  * Requires memcached.
  */
 $wgPasswordAttemptThrottle = array( 'count' => 5, 'seconds' => 300 );
+
+/**
+ * Allow using articlepath for links where the only querystring is a curid (e.g. use /wiki/Main_Page?curid=1)
+ * WARNING: This will not work for all hosts or configuration setup, so BE CAREFUL.
+ * Only use this setting if you have to, as it is not recommended.
+ */
+$wgArticlePathForCurid = false;
index 9cfdba1..b1fcce2 100644 (file)
@@ -809,7 +809,7 @@ class Title {
         */
        public function getLocalURL( $query = '', $variant = false ) {
                global $wgArticlePath, $wgScript, $wgServer, $wgRequest;
-               global $wgVariantArticlePath, $wgContLang, $wgUser;
+               global $wgVariantArticlePath, $wgContLang, $wgUser, $wgArticlePathForCurid;
 
                if( is_array( $query ) ) {
                        $query = wfArrayToCGI( $query );
@@ -833,7 +833,7 @@ class Title {
                        }
                } else {
                        $dbkey = wfUrlencode( $this->getPrefixedDBkey() );
-                       if ( $query == '' ) {
+                       if ( $query == '' || ($wgArticlePathForCurid && substr_count( $query, '&' ) == 0 && strpos( $query, 'curid=' ) === 0 ) ) {
                                if( $variant != false && $wgContLang->hasVariants() ) {
                                        if( $wgVariantArticlePath == false ) {
                                                $variantArticlePath =  "$wgScript?title=$1&variant=$2"; // default
@@ -845,6 +845,13 @@ class Title {
                                } else {
                                        $url = str_replace( '$1', $dbkey, $wgArticlePath );
                                }
+                               if( $query ){
+                                       if( strpos( $url, '&' ) ){
+                                               $url .= '&' . $query;
+                                       }else{
+                                               $url .= '?' . $query;
+                                       }
+                               }
                        } else {
                                global $wgActionPaths;
                                $url = false;